package com.mccken.demo;

/**
 * @program: mccken-collect
 * @description:
 * @author: mccken
 * @create: 2023-11-16 12:18
 **/
public class Temp {
	
	public void traverse(int[] arr) {
		for (int i = 0; i < arr.length; i++) {
			// 迭代访问arr[i] 	
		}
	}
	
	class ListNode {
		int val;
		ListNode next;
	}
	
	// 迭代访问链表
	public void traverse1(ListNode head) {
		for (ListNode p = head; p != null; p = p.next) {
			// 遍历迭代 p.val 	
		}
	}
	
	// 递归访问链表
	public void traverse2( ListNode head) {
		// 前序遍历 head.val
		traverse2(head.next);
		// 后续遍历 head.val
	}
	
}
